package com.mm.service;

import com.mm.mapper.UserMapper;
import com.mm.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Random;

/**
 * @author XiaoLuo
 * @ClassName: UserService
 * @Description: ${todo}
 * @date 2019/4/6 20:22
 */
@Service
public class UserService {

	@Autowired
	private UserMapper userMapper;

	public User queryById(Long id) {
		// 为了演示超时现象，我们在这里然线程休眠,时间随机 0~2000毫秒
		try {
			Thread.sleep(new Random().nextInt(2000));
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return this.userMapper.selectByPrimaryKey(id);
	}
}
